﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EWechatNotice
{
    /// <summary>
    /// 文本卡片消息
    /// </summary>
    public class CorpSendTextCard : CorpSendBase
    {
        public CorpSendTextCard()
        {
            this.msgtype = "textcard";
            this.textcard = new CorpSendTextCardEntity();
        }

        public CorpSendTextCard(string title, string description, string url, string btntxt = "详情")
        {
            this.msgtype = "textcard";
            this.textcard = new CorpSendTextCardEntity(title, description, url, btntxt);
        }

        /// <summary>
        /// 消息内容
        /// </summary>
        public CorpSendTextCardEntity textcard { get; set; }
    }

    public class CorpSendTextCardEntity
    {
        /// <summary>
        /// 标题，不超过128个字节，超过会自动截断
        /// </summary>
        public string title { get; set; }
        /// <summary>
        /// 描述，不超过512个字节，超过会自动截断
        /// </summary>
        public string description { get; set; }
        /// <summary>
        /// 点击后跳转的链接。
        /// </summary>
        public string url { get; set; }
        /// <summary>
        /// 按钮文字。 默认为“详情”， 不超过4个文字，超过自动截断。
        /// </summary>
        public string btntxt { get; set; }

        public CorpSendTextCardEntity()
        { }

        public CorpSendTextCardEntity(string title, string description, string url, string btntxt = "详情")
        {
            this.title = title;
            this.description = description;
            this.url = url;
            this.btntxt = btntxt;
        }
    }
}
